Compiler and Linker Options

Sections in this Topic:

Configurations for Creating Applications and DLLs

Four configurations for creating applications and DLLs are generated in Visual Studio when you create a project using one of the RTX64 templates:

x64

For instructions on manually building a 32-bit application, see Building a 32-bit User Space Application.

Environment Variables Used in Project Settings

RTX64 uses the following environment variables in its project settings:

Category Environment Variable
RTX64 SDK $(RTX64SDKDIR<MAJORVERSION>)

Where <MAJORVERSION> is the major version of the RTX64 product. For example, for RTX64 4.0, the path is:

$(RTX64SDKDIR4)

RTX64 Runtime $(RTX64DIR)
Tools

$(RTX64Common)

RTX64 Custom Macro

$(Rtx64Platform)

This is used to find the correct library directory for projects. This custom macro requires two property files, which are installed with the RTX64 SDK:

  • Rtx64.cpp.x64.user.props
  • Rtx64.cpp.win32.user.props

NOTE: If you are creating an RTSS application from a Windows console, you must change this custom macro to $(Processarchitecture)

Compiler and Linker Options for Application Projects

The RTSS compiler and linker options listed below differ from the default Windows console application and RTX64 product options.

Compiler Options

General
Option RTSSDebug RTSSRelease Debug Release

Additional Include Directories

$(RTX64SDKDIR <MAJORVERSION>)include;%+ inherit

$(RTX64SDKDIR <MAJORVERSION>)include;%+ inherit

$(RTX64SDKDIR <MAJORVERSION>)include;%+ inherit

$(RTX64SDKDIR <MAJORVERSION>)include;%+ inherit

Debug Information Format

Program Database (/Zi)

Program Database (/Zi)

Program Database (/Zi)

Program Database (/Zi)

Optimization
Option RTSSDebug RTSSRelease Debug Release

Optimization

Disabled (/Od)

Enabled (/Ox)

Disabled (/Od)

Maximize Speed (/02)

Whole Program Optimization

No

No

No

No

Preprocessor
Option RTSSDebug RTSSRelease Debug Release

Preprocessor Defines

_AMD64_; UNDER_RTSS; _DEBUG;+ inherit

NOTE: Include the UNDER_RTSS_UNSUPPORTED_CRT_APIS define to see what C Runtime functions have been deprecated.

_AMD64_; UNDER_RTSS; NDEBUG;+ inherit

NOTE: Include the UNDER_RTSS_UNSUPPORTED_CRT_APIS define to see what C Runtime functions have been deprecated.

-UNICODE;UNICODE;% + inherit

NOTE: Unicode or MultiByte, depending on what was selected for Supported String Convention in the template.

_UNICODE;UNICODE;% + inherit

NOTE: Unicode or MultiByte, depending on what was selected for Supported String Convention in the template.

Code Generation
Option RTSSDebug RTSSRelease Debug Release

Enable Minimal Rebuild

No (/Gm-)

No (/Gm-)

Yes (/Gm)

No (/Gm-)

Enable C++ Exceptions

Yes (/EHsc)

Yes (/EHsc)

Yes (/EHsc)

Yes (/EHsc)

Basic Runtime Checks

Default

Default

Both (/RTC1, equiv. to /RTCsu) (/RTC1)

Default

Runtime Library

Multi-threaded Debug (/MTd)

Multi-threaded (/MT)

Multi-threaded Debug (/MTd)

Multi-threaded (/MT)

Buffer Security Check

No (/GS-)

No (/GS-)

No (/GS-)

No (/GS-)

Floating Point Model

Precise (/fp:precise)

NOTE: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected.

Precise (/fp:precise)

NOTE: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected.

Precise (/fp:precise)

NOTE: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected.

Precise (/fp:precise)

NOTE: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected.

Linker Options

General
Option RTSSDebug RTSSRelease Debug Release

Additional Library Directories

$(RTX64SDKDIR <MAJORVERSION>)lib\$(Rtx64Platform);% + inherit

$(RTX64SDKDIR <MAJORVERSION>)lib\$(Rtx64Platform);% + inherit

$(RTX64SDKDIR <MAJORVERSION>)lib\$(Rtx64Platform);% + inherit

$(RTX64SDKDIR <MAJORVERSION>)lib\$(Rtx64Platform);% + inherit

Input
Option RTSSDebug RTSSRelease Debug Release

Additional Dependencies

startupCRT.lib;libcmtd.lib; libcpmtd.lib;libvcruntimed.lib; libucrtd.lib;rtx_rtss.lib

NOTE: startupCRT.lib and libcmtd.lib are dependent on the C Runtime. libcpmtd.lib only appears in C++ projects.

startupCRT.lib;libcmt.lib; libcpmt.lib;libvcruntime .lib;libucrt.lib;rtx_rtss.lib

NOTE: startupCRT.lib and libcmt.lib are dependent on the C Runtime. libcpmt.lib only appears in C++ projects.

rtapi.lib + inherit

rtapi.lib + inherit

Ignore All Default Libraries

Yes (/NODEFAULTLIB)

Yes (/NODEFAULTLIB)

No

No

Manifest File
Option RTSSDebug RTSSRelease Debug Release

Generate Manifest

No (/MANIFEST:NO)

No (/MANIFEST:NO)

Yes (/MANIFEST)

Yes (/MANIFEST)

Enable User Account Control (UAC)

No (/MANIFESTUAC:NO)

No (/MANIFESTUAC:NO)

Yes (/MANIFESTUAC:)

Yes (/MANIFESTUAC:)

Debugging
Option RTSSDebug RTSSRelease Debug Release

Generate Debug Info

Yes (/DEBUG)

Yes (/DEBUG)

Yes (/DEBUG)

Yes (/DEBUG)

System
Option RTSSDebug RTSSRelease Debug Release

Subsystem

Native (/SUBSYSTEM: NATIVE)

Native (/SUBSYSTEM: NATIVE)

Console (/SUBSYSTEM: CONSOLE)

Console (/SUBSYSTEM: CONSOLE)

Driver

Driver (/Driver)

Driver (/Driver)

Not Set

Not Set

Advanced
Option RTSSDebug RTSSRelease Debug Release

Entry Point

_RtapiProcessEntry or_RtapiProcessEntryCRT

_RtapiProcessEntry or_RtapiProcessEntryCRT

 

 

Randomized Base Address

 

 

Yes (/DYNAMICBASE)

Yes (/DYNAMICBASE)

Data Execution Prevention (DEP)

Yes (/NXCOMPAT)

Yes (/NXCOMPAT)

Yes (/NXCOMPAT)

Yes (/NXCOMPAT)

Target Machine

MachineX64 (/MACHINE:X64)

MachineX64 (/MACHINE:X64)

MachineX64 (/MACHINE:X64)

MachineX64 (/MACHINE:X64)

Compiler and Linker Options for DLL Projects

The tables below list the RTSS compiler and linker options that differ from the default Windows console application options and RTX64 product compiler and linker options.

Compiler Options

General
Option RTSSDebug RTSSRelease Debug Release

Additional Include Directories

$(RTX64SDKDIR <MAJORVERSION>)\include + Inherit

$(RTX64SDKDIR <MAJORVERSION>)\include + Inherit

$(RTX64SDKDIR <MAJORVERSION>)\include + Inherit

$(RTX64SDKDIR <MAJORVERSION>)\include + Inherit

Debug Information Format

Program Database (/Zi)

Program Database (/Zi)

Program Database (/Zi)

 

Warning Level

Level3 (/W3)

Level3 (/W3)

Level1 (/W1)

Level1 (/W1)

Optimization
Option RTSSDebug RTSSRelease Debug Release

Optimization

Disabled (/Od)

Enabled (/Ox)

Disabled (/Od)

Maximum Speed (/O2)

Whole Program Optimization

No

No

No

No

Preprocessor
Option RTSSDebug RTSSRelease Debug Release

Preprocessor Defines

_AMD64_; UNDER_RTSS; _DEBUG; RTX64_EXPORTS; + inherit

NOTE: RTX64_EXPORTS is name dependent.

_AMD64_; UNDER_RTSS; NDEBUG; RTX64_EXPORTS; + inherit

NOTE: RTX64_EXPORTS is name dependent.

DLL64_EXPORTS; + inherit

NOTE: DLL64_EXPORTS is name dependent.

DLL64_EXPORTS; + inherit

NOTE: DLL64_EXPORTS is name dependent.

Code Generation
Option RTSSDebug RTSSRelease Debug Release

Enable Minimal Rebuild

No (/Gm-)

No (/Gm-)

Yes (/Gm)

No (/Gm-)

Enable C++ Exceptions

Yes (/EHsc)

Yes (/EHsc)

Yes (/EHsc)

Yes (/EHsc)

Basic Runtime Checks

Default

Default

Both (/RTC1, equiv. to /RTCsu) (/RTC1)

Default

Runtime Library

Multi-threaded Debug (/MTd)

Multi-threaded (/MT)

Multi-threaded Debug (/MTd)

Multi-threaded (/MT)

Buffer Security Check

Yes (/GS)

Yes (/GS)

Yes (/GS)

Yes (/GS)

Floating Point Model

Precise (/fp:precise)

Precise (/fp:precise)

Precise (/fp:precise)

Precise (/fp:precise)

Linker Options

Input
Option RTSSDebug RTSSRelease Debug Release

Additional Dependencies

startupDllCrt.lib;libcmtd.lib; libcpmtd.lib;rtx_rtss.lib

startupDllCrt.lib;libcmt.lib; libcpmt.lib;libvcruntime .lib;libucrt.lib;rtx_rtss.lib

rtapi.lib + inherit

rtapi.lib + inherit

Ignore All Default Libraries

Yes (/NODEFAULTLIB)

Yes (/NODEFAULTLIB)

No

No

Manifest File
Option RTSSDebug RTSSRelease Debug Release

Generate Manifest

No (/MANIFEST:NO)

No (/MANIFEST:NO)

Yes (/MANIFEST)

Yes (/MANIFEST)

Enable User Account Control (UAC)

No (/MANIFESTUAC:NO)

Yes (/MANIFESTUAC:)

Yes (/MANIFESTUAC:)

Yes (/MANIFESTUAC:)

Debugging
Option RTSSDebug RTSSRelease Debug Release

Generate Debug Info

Yes (/DEBUG)

Yes (/DEBUG)

Yes (/DEBUG)

Yes (/DEBUG)

System
Option RTSSDebug RTSSRelease Debug Release

SubSystem

Native (/SUBSYSTEM: NATIVE)

Native (/SUBSYSTEM: NATIVE)

Console (/SUBSYSTEM: CONSOLE)

Console (/SUBSYSTEM: CONSOLE)

Driver

Driver (/Driver)

Driver (/Driver)

Not Set

Not Set

Advanced
Option RTSSDebug RTSSRelease Debug Release

Entry Point

_RtapiDllEntry or _RtapiDllEntryCRT

_RtapiDllEntry or_RtapiDllEntryCRT

 

 

Randomized Base Address

 

 

Yes (/DYNAMICBASE)

Yes (/DYNAMICBASE)

Data Execution Prevention (DEP)

Yes (/NXCOMPAT)

Yes (/NXCOMPAT)

Yes (/NXCOMPAT)

Yes (/NXCOMPAT)

Target Machine

MachineX64 (/MACHINE:X64)

MachineX64 (/MACHINE:X64)

MachineX64 (/MACHINE:X64)

MachineX64 (/MACHINE:X64)

Stack Size

The /STACK linker option is available to set the size of the main thread's stack in bytes. The default stack size for RTSS configurations is:

Configuration Stack Size

RTSSRelease

Default (8 pages, 32768 bytes)

RTSSDebug with C/C++ Runtime support enabled

32 pages, 131072 bytes

RTSSDebug without C/C++ Runtime support

Default (8 pages, 32768 bytes)

NOTE: The above values are for the stack size for the main thread only. All subsequent thread's stacks are created based on the size set when calling CreateThread. If no size is set in CreateThread, the default is 8 pages.

IMPORTANT! The stack does not grow in RTSS. As such, you must be aware of the amount of space you need on the Stack. A Green Screen can result if the Stack size is too small.

To set the Stack size:

To set this option in the Visual Studio environment:

NOTE: Although a value must be entered for Stack Reserve Size, it is not used. Only the value in the Commit box is used.

For more information, see the Microsoft documentation on /STACK (Stack allocations).

Related Topics: